/**
 * 代码参考 lodash uniquiId
 */
const idCounter: { [k: string]: any } = {};

function uniqueId(prefix = "$shirkhan$") {
  if (!idCounter[prefix]) {
    idCounter[prefix] = 0;
  }

  const id = ++idCounter[prefix];
  if (prefix === "$shirkhan$") {
    return `${id}`;
  }

  return `${prefix}${id}`;
}

export default uniqueId;
